﻿#ifndef _BRICKEX_H_
#define _BRICKEX_H_

#include <d3dx9.h>
#include "Sprite.h"
#include "CGame.h"
#include "Object.h"
#include "Global.h"
#include "Texture.h"

#define BRICK_GRAVITY		0.01


class BrickEx : public Object
{
	float _xPre;
	float _yPre;

	bool isLastMoveUp;			//kiem tra gach co duoc day len chua?

	Sprite* _spriteArr[4];
	bool isBreaked;

	float	xBreak1;		//Tham số của các mảnh vỡ. 1 là mảnh trên, 2 là mảnh dưới
	float	yBreak1;
	float	xBreak2;
	float	yBreak2;
	float	vyBreak1;
	float	vyBreak2;
	float	vxBreak1;
	float	vxBreak2;
	float	ayBreak;
	float	angle;


public:

	/*
	 *	Constructor
	 */
	BrickEx(int id, float x, float y, int state, int type);
	~BrickEx();

	
	/*
	 *	Method
	 */
	//void render();
	void Render(int vpX, int vpY);
	void Update(list<Object*>* obj_list, float TPF);

	
	OBJECT_TYPE getObjectType();


	
	void changeState(int state);
};

#endif